<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New track record</title>
<style type="text/css">
.error-validation{
color: red;
}
</style>
<script type="text/javascript" src="<c:url value='/js/jquery-1.4.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/jquery.springmvc.ajax.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/jquery.form.js'/>"></script>
<script type="text/javascript">
$(document).ready(function(){

  $("#status").change(function(){

    var params={
      "value" : $(this).val()
    };  
  });

    $("#form-ajax").ajaxSpringMVCValidation("error-validation","#response");

});

</script>
</head>
<body>
<div><b>New Track Record</b></div>

<div id="response">
<c:url value="/register/addTrack.do" var="url" />

<form:form action="${url}" method="post" modelAttribute="trackRow" id="form-ajax">

  <div>Artist : *</div>
  <div><form:input path="artist" /><form:errors cssClass="error-validation" path="artist"/></div>
  
  <div>Track : *</div>
  <div><form:input path="title" /><form:errors cssClass="error-validation" path="title"/></div>
  
  <div>Album : *</div>
  <div><form:input path="album" /><form:errors cssClass="error-validation" path="album"/></div>
  
  <div>Track Number : *</div>
  <div><form:input path="trackNumber" /><form:errors cssClass="error-validation" path="trackNumber"/></div>
  
  <div>Length : *</div>
  <div><form:input path="length" /><form:errors cssClass="error-validation" path="length"/></div>
  
  <div>Status : *</div>
  <div><form:select path="status">
    <form:option value="-">SELECT</form:option>
    <form:options itemLabel="value" items="${statusList}"/>
  </form:select><form:errors cssClass="error-validation" path="status"/>
  </div>
 
  <input type="Submit" value="Enviar"/>
</form:form>
</div>
</body>
</html>